package part06_装饰者模式;

/**
 * @ClassName: CoffeeBar
 * @Author: AllenSun
 * @Date: 2020/3/1 18:07
 */
public class CoffeeBar {
    public static void main(String[] args) {
        //装饰者模式下的订单：2份巧克力+一份牛奶的LongBlack
        //1-单点一份咖啡
        Drink order=new LongBlack();
        System.out.println("咖啡钱："+order.cost());
        System.out.println("描述："+order.getDescription());

        //2-加入一份牛奶
        order=new Milk(order);
        System.out.println("加入一份牛奶的咖啡钱："+order.cost());
        System.out.println("描述："+order.getDescription());

        //3-再加入一份牛奶
        order=new Milk(order);
        System.out.println("加入两份牛奶的咖啡钱："+order.cost());
        System.out.println("描述："+order.getDescription());

        //4-再加入一份巧克力
        order=new Chocolate(order);
        System.out.println("加入一份巧克力的咖啡钱："+order.cost());
        System.out.println("描述："+order.getDescription());
    }
}
